﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Backend.JYD.Model.Cust;
using Backend.JYD.Model;

namespace Backend.JYD.BLL.Cust
{
    public class CustAssetsBLL
    {
        private static readonly IDAL.Cust.ICustAssets idal = Factory.DALFactory.CreateEFDAL<IDAL.Cust.ICustAssets>("DAL.CustAssetsDAL");

        public IList<CustAsset> GetCustAssetByCustNos(IList<string> custNos)
        {
            if (custNos != null || custNos.Count <= 0) return null;
            return idal.GetCustAssetByCustNos(custNos);
        }

        public bool UpdateCustAsset(CustAsset info)
        {
            if (string.IsNullOrWhiteSpace(info.CustNo)) return false;
            if (info.TaskId <= 0) return false;
            if (info.TaskDetailId <= 0) return false;
            if (info.Deposit < 0) return false;
            if (info.NationalDebt < 0) return false;
            
            return idal.UpdateCustAsset(info);
        }

        public PageInfo<CustAsset> GetCustAssetByPage(PageInfo page)
        {
            return idal.GetCustAssetByPage(page);
        }
    }
}
